﻿/**
 * Created by xjchen on 2020-03-20.
 * */

#ifndef MIDDLEWARE_SRIOWRITER_H
#define MIDDLEWARE_SRIOWRITER_H


#include "DeviceWriter.h"
#include "SrioReader.h"
#include "AutoDetectWriter.h"

class SrioWriterPrivate;

class SrioWriter : public DeviceWriter {
public:
    ~SrioWriter();

    SrioWriter(uint16_t deviceID, uint16_t channel, bool isBlocking);

    int64_t onWrite(char *buffer, int64_t len) override;

    void changeTarget(int deviceId, int channel);

    void setOwner(AutoDetectWriter *writer);

    void setupConnection() override;

    void stop() override;

private:
    friend class SrioWriterPrivate;

    SrioWriterPrivate *srioWriterPriv;
    AutoDetectWriter *owner = 0;
};


#endif /** MIDDLEWARE_SRIOWRITER_H */
